﻿using System;
using System.Collections.Generic;
using System.Collections.Specialized;

namespace QDT.Payment
{
    public interface IPayment
    {

        /// <summary>
        /// 识别Key,一般为类名
        /// </summary>
        string Key { get; }

        /// <summary>
        /// 名字
        /// </summary>
        string Name { get;}

        /// <summary>
        /// 是否是在线支付
        /// </summary>
        bool OnlinePaly { get;}

        /// <summary>
        /// 手续费计算方式（0：定额  1：比率）
        /// </summary>
        int FeeType { get; set; }

        /// <summary>
        /// 手续费值
        /// </summary>
        decimal FeeAmount { get; set; }

        /// <summary>
        /// 描述
        /// </summary>
        string Description { get; set; }

        /// <summary>
        /// 发送支付请求到支付网关
        /// </summary>
        /// <param name="order">支付订单信息</param>
        /// <returns></returns>
        void InchargeRequest(PaymentOrder order);

        bool InchargeQueryRequest(PaymentOrder order);

        /// <summary>
        /// 发送提现请求到支付网关
        /// </summary>
        /// <param name="orders">提现订单信息</param>
        /// <returns></returns>
        void CarryRequest(IEnumerable<CarryOrder> orders);

        bool CarryRequest(CarryOrder order);

        /// <summary>
        /// 发送提现查询到支付网关
        /// </summary>
        /// <param name="orderSn">提现订单流水号</param>
        /// <returns></returns>
        int CarryQueryRequest(string orderSn);

        /// <summary>
        /// 验证交易是否被篡改
        /// </summary>
        /// <param name="form">第三方支付传递的参数</param>
        /// <param name="order"></param>
        /// <returns></returns>
        bool VerifyNotify(NameValueCollection form, out object order);

        /// <summary>
        /// 验证交易是否被篡改，并返回第三方字符的文本,主要用于自动Notice
        /// </summary>
        /// <param name="form"></param>
        /// <param name="returnContent">返回的内容</param>
        /// <param name="order"></param>
        /// <returns></returns>
        bool VerifyNotify(NameValueCollection form, out string returnContent, out object order);
    }
}
